function getUrlMapEnv(id) {
    id =  id || '';
    var host = location.host;
    if (/^local/i.test(host)) {
        return 'qa' + id;
    } else if (/^qa\d?/i.test(host)) {
        return 'qa';
    } else if (/^yz/i.test(host)) {
        return 'yz';
    } else {
        return '';
    }
}

$(function() {
    var env = getUrlMapEnv();
    if(navigator.appName == 'Microsoft Internet Explorer' && !$.cookie('updatetip')){
        var html = '<!--[if lt IE 9]><div class="ie6_tip" style="position: fixed;width: 100%;height: 100%;left: 0;top: 0;z-index: 1000;"><div class="ie6_tip_layer" style="filter:alpha(opacity=50);background:#000;position: absolute;width: 100%;height: 100%;"></div><div class="ie6_tip_main" style="position: absolute;width: 670px;height: 408px;left: 50%;top: 50%;margin-left: -335px;margin-top: -204px;"><img src="//'+env+'res.hjfile.cn/class/static/images/ie6_tip.png" width="670" height="408" usemap="#tip_map" /><map name="tip_map" id="tip_map"><area id="download_chrome" shape="rect" target="_blank" coords="141,218,203,281" href ="http://rj.baidu.com/soft/detail/14744.html?ald" /><area id="download_firefox"shape="rect" target="_blank" coords="298,218,361,281" href ="http://www.firefox.com.cn/" /><area id="download_IE" shape="rect" target="_blank" coords="455,218,516,281" href ="http://windows.microsoft.com/en-us/internet-explorer/download-ie-MCM?FORM=MI09J9&OCID=MI09J9&WT.mc_id=MSCOM_EN_US_DLC_4PF_141B2ENUS51787" /></map></div></div><![endif]-->';
        $('body').append(html);
        ht.sendCustomEvent("upg_display", {
            url: location.href
        });
        $('#download_chrome').click(function(){
            ht.sendCustomEvent('upg_chrome', {
                url: location.href
            });
        });
        $('#download_firefox').click(function(){
            ht.sendCustomEvent('upg_firefox', {
                url: location.href
            });
        });
        $('#download_IE').click(function(){
            ht.sendCustomEvent('upg_IE8', {
                url: location.href
            });
        });
    }
});
